const Router = require("koa-router");
const user = new Router();

user.get("/", async (ctx, next) => {
    ctx.body = {
        code: 200,
        message: "用户列表",
        data: [1, 2, 4],
        ...ctx.query,
    };
});

user.get("/:id", async (ctx, next) => {
    ctx.body = {
        code: 200,
        message: "用户详情",
        data: {
            id: ctx.params.id,
        },
    };
});

user.post("/", async (ctx, next) => {
    ctx.body = {
        code: 200,
        message: "创建用户",
        data: ctx.request.body,
    };
});

module.exports = user;
